package cn.edu.scau.dao;

import cn.edu.scau.entity.Bed;
import org.apache.ibatis.jdbc.SQL;

public class BedSqlProvider {

    public String insertSelective(Bed record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("bed");
        
        if (record.getBedid() != null) {
            sql.VALUES("bedID", "#{bedid,jdbcType=INTEGER}");
        }
        
        if (record.getBedoccupytatus() != null) {
            sql.VALUES("bedOccupyTatus", "#{bedoccupytatus,jdbcType=BIT}");
        }
        
        if (record.getBeddescription() != null) {
            sql.VALUES("bedDescription", "#{beddescription,jdbcType=VARCHAR}");
        }
        
        
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(Bed record) {
        SQL sql = new SQL();
        sql.UPDATE("bed");
        
        if (record.getBedoccupytatus() != null) {
            sql.SET("bedOccupyTatus = #{bedoccupytatus,jdbcType=BIT}");
        }
        
        if (record.getBeddescription() != null) {
            sql.SET("bedDescription = #{beddescription,jdbcType=VARCHAR}");
        }
        
        
        sql.WHERE("bedID = #{bedid,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}